<template>
    <div class="like-wrap">
        <waterfall :col="3" :data="list">
            <template>
                <VideoCover v-for="(item, index) in list" :key="index" :info="item" />
            </template>
        </waterfall>
        <div class="empty" v-if="emptyList">
            <span>تۈگەپتۇ</span>
        </div>
    </div>
</template>
<script>
import VideoCover from "@/components/VideoCover.vue";
import { shareFrend, shareMoments } from "@/utils";
export default {
    components: {
        VideoCover
    },
    data() {
        return {
            list: [],
            emptyList: false,
            error: false
        };
    },
    mounted() {
        shareMoments(this);
        shareFrend(this);
        this.getList();
    },
    methods: {
        getList() {
            try {
                let openId = JSON.parse(window.localStorage.getItem('userInfo')).openid;
                this.$http
                    .get("/getBuyVideo", {
                        params: { openId }
                    })
                    .then(res => {
                        this.list = res;
                        if (res && !res.length) {
                            this.emptyList = true;
                        }
                    })
                    .catch(err => {
                        this.$toast(err);
                    });
            } catch (error) {
                window.history.back();
            }
        }
    }
};
</script>
<style lang="scss" scoped>
.like-wrap {
    min-height: 100vh;
    background-color: #ffffff;
    padding: 0 1vw;
    .empty {
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 35px;
    }
}
</style>